package com.green.card.utils;

import android.util.Log;

import java.io.File;

/**
 * ZYA自定义log日志
 */
public class ZYALogUtils {

	private ZYALogUtils() {
		/* cannot be instantiated */
		throw new UnsupportedOperationException("cannot be instantiated");
	}

	/**
	 * 这个tag标记筛选log日志
	 */
	private static final String TAG = "56card";

	/**
	 * 是否输出log
	 */
	private static final boolean isDebug= isFileExist();

	/**
	 * 通过判断指定目录下文件是否存在，来决定是否输出Log日志
	 * @return
	 */
	private static boolean isFileExist(){
		//目录路径可以自定义。
		File file = new File("/sdcard/zhuo");
		if (file.exists()){
			return true;
		}
		return false;
	}

	public static void v( String msg) {
		if (isDebug) {
			Log.v(TAG, msg);
		}
	}

	public static void d(String msg) {
		if (isDebug) {
			Log.d(TAG, msg);
		}
	}

	public static void i( String msg) {
		if (isDebug) {
			Log.i(TAG, msg);
		}
	}

	public static void w( String msg) {
		if (isDebug) {
			Log.w(TAG, msg);
		}
	}

	public static void e(String msg) {
		if (isDebug) {
			Log.e(TAG, msg);
		}
	}
}
